
import { Seeder } from '@mikro-orm/seeder';
import { MikroORM, MySqlDriver } from '@mikro-orm/mysql';

import config from '../../mikro-orm.config';
import { Options } from '@mikro-orm/core';
import { DatabaseSeeder } from './DatabaseSeeder';
import { ChatSeeder } from './ChatSeeder';

async function bootstrap() {

  const orm = await MikroORM.init<MySqlDriver>(config as Options<MySqlDriver>)
  //const em = orm.em as EntityManager;
      // Get seeder from MikroORM
  
  const seeder = await orm.getSeeder();

  // Refresh the database to start clean (work in mongo too since v5)
  // await orm.getSchemaGenerator().refreshDatabase();

  // Seed using a seeder defined by you
  await seeder.seed(DatabaseSeeder);

}

bootstrap()